<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){

	$.getJSON("json.jsp", function(categories){
   for(var i=0; i<categories.length; i++){
      var name = categories[i].name;
      var department = categories[i].department;
      $("#mytable").append('<tr><td>'+ name +'</td><td>'+department+'</td></tr>');
   }
});
  $.ajax({url:"b.html", success:function(result){
    $("div").html(result);
  }});
});});
</script>
</head>
<body>

<table id="mytable">
   <tr> <th> Name </th> <th> Department </th> </tr>
</table>

<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>
</body>
</html>

